home *** CD-ROM | disk | FTP | other *** search
/ Computer Select (Limited Edition) / Computer Select.iso / dobbs / v17n05 / ipx.exe / NETWORK.INC < prev    next >
Encoding:
Text File  |  1992-02-01  |  9.7 KB  |  212 lines

  1. ; *************************************************************************************************
  2. ; *
  3. ; *    Title:    NETWORK.INC
  4. ; *    Copyright (c) December 1991, Ryu Consulting, 916/722-1939
  5. ; *    Written by Rahner James
  6. ; *
  7. ; *    This is a header file for all the assembly language functions in the Novell network library
  8. ; *
  9. ; *************************************************************************************************
  10.  
  11. ifdef    LARGEMODEL
  12.     .model    large,c
  13. else
  14.     .model    small,c
  15. endif
  16.     .286
  17.  
  18. ; *************************************************************************************************
  19. ; *
  20. ; *                    Definitions
  21. ; *
  22. ; *************************************************************************************************
  23.  
  24. IPX_FLAG    equ    (0 shl 0)    ; Packet is used for IPX, see ecb_type field in ECB_S
  25. SPX_FLAG    equ    (1 shl 0)    ; Packet is used for SPX, this must be a 1
  26. LISTEN_FLAG    equ    (0 shl 1)    ; Packet is used for listening
  27. TALK_FLAG    equ    (1 shl 1)    ; Packet is used for talking, this must be a 1
  28. FULL_FLAG    equ    (1 shl 2)    ; Set if this packet has come back from listening with data
  29.  
  30. IPX_PACKET    equ    4        ; Packet type for IPX
  31. SPX_PACKET    equ    5        ; Packet type for SPX
  32.  
  33. DEFAULT_TALKERS    equ    5    ; Default number of talking packets for the IPX/SPX open functions
  34. DEFAULT_LISTENERS    equ    5    ; Default number of listening packets for the IPX/SPX open functions
  35. DEFAULT_HANDLE_MAXIMUM    equ    20    ; Maximum number of IPX/SPX handles
  36.  
  37.  
  38. ; *************************************************************************************************
  39. ; *
  40. ; *                    Structures
  41. ; *
  42. ; *************************************************************************************************
  43.  
  44. NET_ADDRESS_S struct
  45.     network    dd    ?        ; Network number
  46.     node    db    6 dup(?)    ; Physical node address
  47.     socket    dw    ?        ; Socket number
  48. NET_ADDRESS_S ends
  49.  
  50.  
  51. IPX_S struct
  52.     checksum    dw    ?    ; Dummy checksum of the 30-byte packet header, filled by IPX
  53.     packet_length    dw    ?    ; Length of the complete IPX packet, filled by IPX
  54.     control        db    ?    ; Transport control byte for internetwork bridges, filled by IPX
  55.     packet_type    db    ?    ; Packet type: IPX=4, SPX=5, defined by Xerox, set by application    *
  56.     dest_network    dd    ?    ; Network number, set by application                    *
  57.     dest_node    db    6 dup(?); Physical node address, set by application                *
  58.     dest_socket    dw    ?    ; Socket number, set by application                    *
  59.     src_network    dd    ?    ; Network number
  60.     src_node    db    6 dup(?); Physical node address
  61.     src_socket    dw    ?    ; Socket number
  62. IPX_S ends
  63.  
  64.  
  65. SPX_S struct
  66.     checksum    dw    ?    ; Dummy checksum of the 30-byte packet header, filled by IPX
  67.     packet_length    dw    ?    ; Length of the complete IPX packet, filled by IPX
  68.     control        db    ?    ; Transport control byte for internetwork bridges, filled by IPX
  69.     packet_type    db    ?    ; Packet type: IPX=4, SPX=5, defined by Xerox, set by application    *
  70.     dest_network    dd    ?    ; Network number, set by application                    *
  71.     dest_node    db    6 dup(?); Physical node address, set by application                *
  72.     dest_socket    dw    ?    ; Socket number, set by application                    *
  73.     src_network    dd    ?    ; Network number
  74.     src_node    db    6 dup(?); Physical node address
  75.     src_socket    dw    ?    ; Socket number
  76.  
  77.     con_control    db    ?    ; Connection control structure, set by SPX
  78.     datastream    db    ?    ; Datastream type, 0x00-0xFD are ignored, set by application        *
  79.     src_ID        dw    ?    ; Source connection ID, used by SPX, filled by SPX
  80.     dest_ID        dw    ?    ; Destination connection ID, used by SPX, filled by SPX
  81.     sequence    dw    ?    ; Sequence number to keep track of the packet sequence, filled by SPX
  82.     ACK_number    dw    ?    ; Acknowledge number, used by SPX, filled by SPX
  83.     allocation    dw    ?    ; Allocation number, used by SPX, filled by SPX
  84. SPX_S ends
  85.  
  86.  
  87. ECB_HEADER_S struct
  88.     next        dd    ?    ; Used by IPX/SPX when the ECB is active, can be used when ECB is inactive
  89.     function    dd    0    ; Called when packet sent/recd, called Event Service Routine, set by application    s,r
  90.     in_use        db    ?    ; Flag used by IPX/SPX while it processes the ECB, !0 while in use, set by IPX/SPX
  91.     completion_code    db    ?    ; Completion code that is valid only when in_use is set to 0, set by IPX/SPX
  92.     socket        dw    ?    ; Transmission/reception socket to use for this ECB, set by application            s,r
  93.     IPX_work    db    4 dup(?); Workspace used internally by IPX, set by IPX
  94.     driver_work    db    12 dup(?); Workspace used internally by the IPX driver, set by IPX
  95.     dest_address    db    6 dup(?); Address of the node to which the packet(s) is sent/received, set by application and IPX
  96.     fragment_count    dw    ?    ; Number of address/size IPX/SPX fragments that follow, set by application        s,r
  97. ECB_HEADER_S ends
  98.  
  99.  
  100. FRAGMENT_S struct
  101.     fragment_ptr    dd    ?    ; -> buffer that data is sent from or received into
  102.     fragment_size    dw    ?    ; Size of that buffer
  103. FRAGMENT_S ends
  104.  
  105.  
  106. ECB_S struct    ; This defines the structure of a single packet ECB, it contains both an ECB and an SPX structure
  107.     next        dd    ?    ; Used by IPX/SPX when the ECB is active, used by this program when back from IPX/SPX
  108.     function    dd    0    ; Called when packet sent/recd, called Event Service Routine, set by application    s,r
  109.     in_use        db    ?    ; Flag used by IPX/SPX while it processes the ECB, !0 while in use, set by IPX/SPX
  110.     completion_code    db    ?    ; Completion code that is valid only when in_use is set to 0, set by IPX/SPX
  111.     socket        dw    ?    ; Transmission/reception socket to use for this ECB, set by application            s,r
  112.     IPX_work    db    4 dup(?); Workspace used internally by IPX, set by IPX
  113.     driver_work    db    12 dup(?); Workspace used internally by the IPX driver, set by IPX
  114.     dest_address    db    6 dup(?); Address of the node to which the packet(s) is sent/received, set by application and IPX
  115.     fragment_count    dw    ?    ; Number of address/size IPX/SPX fragments that follow, set by application        s,r
  116.  
  117.     hdr        dd    ?    ; -> header for this transmission/reception descriptor, both IPX/SPX start the same    s,r
  118.     size_hdr    dw    ?    ; Number of bytes in the header, must be set to IPX or SPX header size by application    s,r
  119.     buffer_ptr    dd    ?    ; -> data to send/receive                                s,r
  120.     size_buffer    dw    ?    ; Must be set by application on transmission of the packet                s
  121.  
  122.     checksum    dw    ?    ; Dummy checksum of the 30-byte packet header, filled by IPX
  123.     packet_length    dw    ?    ; Length of the complete IPX packet, filled by IPX
  124.     control        db    ?    ; Transport control byte for internetwork bridges, filled by IPX
  125.     packet_type    db    ?    ; Packet type: IPX=4, SPX=5, defined by Xerox, set by application    *
  126.     dest_network    dd    ?    ; Network number, set by application                    *
  127.     dest_node    db    6 dup(?); Physical node address, set by application                *
  128.     dest_socket    dw    ?    ; Socket number, set by application                    *
  129.     src_network    dd    ?    ; Network number of the source, filled by IPX/SPX
  130.     src_node    db    6 dup(?); Physical node address of the source, filled by IPX/SPX
  131.     src_socket    dw    ?    ; Socket number of the source, filled by IPX/SPX
  132.  
  133.     con_control    db    ?    ; Connection control structure, set by SPX
  134.     datastream    db    ?    ; Datastream type, 0x00-0xFD are ignored, set by application        *
  135.     src_ID        dw    ?    ; Source connection ID, used by SPX, filled by SPX
  136.     dest_ID        dw    ?    ; Destination connection ID, used by SPX, filled by SPX
  137.     sequence    dw    ?    ; Sequence number to keep track of the packet sequence, filled by SPX
  138.     ACK_number    dw    ?    ; Acknowledge number, used by SPX, filled by SPX
  139.     allocation    dw    ?    ; Allocation number, used by SPX, filled by SPX
  140.  
  141.     next_sibling    dw    ?    ; Segment of the next packet allocated to this socket
  142.     parent        dw    ?    ; Segment of the LISTEN_S header that owns this packet
  143.     user_function    dd    ?    ; Function to call after list management has occurred
  144.     ecb_type    db    ?,?    ; Bit0:0 IPX,1 SPX;Bit1:0 listener;1 talker
  145.  
  146.     buffer        db    ?    ; Start of the buffer
  147. ECB_S ends
  148.  
  149.  
  150. LIST_S struct
  151.     next            dw    0    ; Segment of the next listening list
  152.     socket            dw    0    ; Socket number that this structure is associated with
  153.     first_unprocessed_ECB    dw    0    ; Segment of the first received block that has not been processed
  154.     last_unprocessed_ECB    dw    0    ; Segment of the last received block that has not been processed
  155.     unprocessed_count    dw    0    ; Number of unprocessed ECBs
  156.     first_free_ECB        dw    0    ; Segment of the first free packet that we can use for transmission
  157.     free_count        dw    0    ; Number of free ECBs
  158.     first_allocated_ECB    dw    0    ; -> first allocated packet associated with this list
  159.     listener_count        dw    0    ; Number of listeners attached to this socket
  160.     talker_count        dw    0    ; Number of talkers attached to this socket
  161.     total_transmissions    dd    0    ; Number of transmissions made through this socket
  162.     total_receptions    dd    0    ; Number of receptions made from this socket
  163. LIST_S ends
  164.  
  165.  
  166. HANDLE_S struct
  167.     network        dd    ?        ; Network number, this MUST always be at the front
  168.     node        db    6 dup(?)    ; Physical node address, this MUST be second
  169.     socket        dw    ?        ; Socket number, 0 if not open
  170.     list_ptr    dw    ?        ; -> socket list header, points to next available when not in use
  171.     partial_count    dw    ?        ; Total number of bytes read from the current unprocessed packet
  172. HANDLE_S ends
  173. HANDLE_SHIFT    equ    0            ; Shift value to convert from index to a structure segment
  174.  
  175.  
  176. ; *************************************************************************************************
  177. ; *
  178. ; *                    Macros
  179. ; *
  180. ; *************************************************************************************************
  181.  
  182. IPX    macro    command
  183.     mov    bx, command
  184.     push    bp
  185.     call    dword ptr IPX_Vector    ; Call the IPX function
  186.     pop    bp
  187.     endm
  188.  
  189.  
  190. IPX_CHECK macro command
  191.     mov    bx, command
  192.     push    bp
  193.     call    dword ptr IPX_Vector    ; Call the IPX function
  194.     pop    bp
  195.     cbw
  196.     or    ax, ax            ; Check the return code in AL
  197.     endm
  198.  
  199.  
  200. ; *************************************************************************************************
  201. ; *
  202. ; *                    External Definitions
  203. ; *
  204. ; *************************************************************************************************
  205.  
  206. ifndef _XPX_INIT_ASM_
  207.  
  208. extern    IPX_Vector:dword, _Our_Address:dword
  209. extern    _Socket_Life:byte, _SPX_Version:word, _SPX_Max_Connections:word, _SPX_Available_Connections:word
  210.  
  211. endif
  212.